<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/9/6
  Time: 11:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <%
        //新建Cookie
        Cookie cookie=new Cookie("name","aaa");
        //设置cookied的有效期
        cookie.setMaxAge(5*60);
        //写入Cookie
        response.addCookie(cookie);
        //跳转到读取cookie的页面
        response.sendRedirect("getCookie.jsp");
    %>
</body>
</html>
